<?php
class helper_headTitle extends system_view_helper_abstract {
	public function headTitle() {
		return $this;
	}
	
	public function render() {
		$crumbs = system_nav_crumbs::getInstance()->getPages();
		if(empty($crumbs)) {
			return '';
		}
		$labels = array();
		foreach($crumbs AS $page) {
			$labels[] = $this->getView()->escape($page->getLabel());
		}
		krsort($labels);
		return implode(' - ', $labels);
	}
	
	public function __toString() {
		return $this->render();
	}
}